<?php


namespace App\Controller;

use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\Utils\Context;

/**
 * @AutoController()
 * @property int foo
 * Class CoController
 * @package App\Controller
 */
class CoController
{
    public function get(){
        return $this->foo;
    }

    public function update(RequestInterface $request){
        $foo = $request->input('foo');
        $this->foo = $foo;
        return $this->foo;
    }

    public function __get($name)
    {
        return Context::get(__CLASS__.':'.$name);
    }

    public function __set($name, $value)
    {
        Context::set(__CLASS__.':'.$name, $value);
    }
}